<?php
/**
 * The template for displaying Archive pages.
 *
 * Used to display archive-type pages if nothing more specific matches a query.
 * For example, puts together date-based pages if no date.php file exists.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
include('blog-frame/header.php');
?>

<div id="content" class="clearfix">
    <div id="main" class="col620 clearfix" role="main">

			<?php if ( have_posts() ) : ?>

				<header class="page-header">
					<h1 class="page-title">
						<?php
							if ( is_day() ) :
								printf( __( 'Daily Archives: %s', 'living-journal' ), '<span class="yellow">' . get_the_date() . '</span>' );
							elseif ( is_month() ) :
								printf( __( 'Monthly Archives: %s', 'living-journal' ), '<span class="yellow">' . get_the_date( 'F Y' ) . '</span>' );
							elseif ( is_year() ) :
								printf( __( 'Yearly Archives: %s', 'living-journal' ), '<span class="yellow">' . get_the_date( 'Y' ) . '</span>' );
							else :
								_e( 'Archives', 'living-journal' );
							endif;
						?>
					</h1>
				</header>

				<?php rewind_posts(); ?>

				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); $categories = get_the_category( $id );?>

        <article id="post-<?php echo $id;?>" class="post-<?php echo $id;?> post type-post status-publish format-standard hentry category-entertainment category-home-and-family">
            <header class="entry-header">
                <h1 class="entry-title">
                    <a href="<?php echo get_permalink($id);?>" title="<?php echo the_title();?>" rel="bookmark"><?php echo the_title();?></a>
                </h1>
                <div class="entry-meta">
                    <span class="sep">Posted on </span>
                    <time class="entry-date" datetime=""><?php echo get_the_time('Y-m-d', $id);?></time>
                </div>
            </header>
            <div class="entry-content post_content">
                <?php echo word_limiter((apply_filters('the_content',get_post_field('post_content', $id))), 50);?>
                <a href="<?php echo get_permalink(the_ID());?>" class="more-link">Continue reading <span class="meta-nav">→</span></a>
            </div>
            <footer class="entry-meta">
                <span class="cat-links">Posted in&nbsp;
                <?php 
                    foreach ($categories as $category):
                ?>
                    <a href="<?php echo get_category_link($category->term_id);?>" title="View all posts in <?php echo $category->name;?>" rel="tag"><?php echo $category->name;?>,&nbsp;</a>
                <?php endforeach;
                ?>
                </span>
            </footer>
        </article>
				<?php endwhile; ?>
				<?php if (function_exists("livingjournal_pagination")) {
							livingjournal_pagination(); 
				} elseif (function_exists("livingjournal_content_nav")) { 
							livingjournal_content_nav( 'nav-below' );
				}?>
			<?php else : ?>
				<article id="post-0" class="post no-results not-found">
					<header class="entry-header">
						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
					</header><!-- .entry-header -->

					<div class="entry-content">
						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
						<?php get_search_form(); ?>
					</div><!-- .entry-content -->
				</article><!-- #post-0 -->
			<?php endif; ?>
			</div><!-- #content -->
<div id="sidebar" class="widget-area col300" role="complementary">
	<?php if(is_active_sidebar('cs-blog-right-sidebar')) dynamic_sidebar( 'cs-blog-right-sidebar' ); ?>
</div><!-- #secondary .widget-area -->


<?php
include('blog-frame/footer.php');
?>